﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TimKen.DataEntity;
using TimKen.BussLogic;
using System.Data;

namespace TimKen.Web.Admin.TransType
{
    public partial class TransType_List : TimKen.App.AdminPage
    {
        private TransTypeManager ttm = new TransTypeManager();
        public override string ActionCode
        {
            get
            {
                return "87";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindResources();
                BindData();
            }
        }

        private void BindResources()
        {
        }


        protected void grdTransType_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int transTypeID = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "EditEvent")
            {
                TimKen.DataEntity.TransType transTypeCn = ttm.GetModel(transTypeID, (int)LanguageEnum.Chinese);
                TimKen.DataEntity.TransType transTypeEn = ttm.GetModel(transTypeID, (int)LanguageEnum.English);
                txtTransTypeID.Value = transTypeCn.TransTypeID.ToString();
                txtTransTypeNameCN.Text = transTypeCn.TransTypeName;
                txtTransTypeNameEN.Text = transTypeEn.TransTypeName;
            }
        }

        private void BindData()
        {
            DataSet ds = ttm.GetList(LanguageWhereStr);
            this.grdTransType.DataSource = ds;
            this.grdTransType.DataBind();
        }
    }
}
